{% extends "base.html" %} {% block head %} {{ super() }}
<script src="{{url_for('static', filename='../static/js/control/ztable.js')}}" type="text/javascript" charset="utf-8"></script>
<script src="{{url_for('static', filename='../static/js/control/zform.js')}}" type="text/javascript" charset="utf-8"></script>
<script src="{{url_for('static', filename='../static/js/app/Project.js')}}" type="text/javascript" charset="utf-8"></script>

<script src="{{url_for('static', filename='../static/datepicker/js/bootstrap-datepicker.js')}}" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="../static/datepicker/css/datepicker.css" type="text/css" media="screen" />


<script src="{{url_for('static', filename='../static/treeview/tree.jquery.js')}}" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="../static/treeview/jqtree.css" type="text/css" media="screen" />

<script>
	$(document).ready(function(){
		
		function select_project($Row){
		}
		
		var $ProjectForm = $('#project-form').ZForm({
			//errors:{{ project_errors | safe }}
		});
		
		var $ProjectList = $('#project-list').ZTable({
			columns:{'name':'Name','description':'Description'}, //'created':'Created Date'},
			datas:{{ projects | safe }},
			select_row_cb: select_project});
		
		var project_panel = new ProjectPanel('project-panel', $ProjectList, $ProjectForm);
		
		var data = [
		            {
		                id: 789,
		                label: 'node1',
		                children: [
		                    { id: 123, label: 'child1' },
		                    { id: 234, label: 'child2' }
		                ]
		            },
		            {
		                id: 901,
		                label: 'node2',
		                children: [
		                    { id: 456, label: 'child3' }
		                ]
		            }
		        ];
	    $('#tree1').tree({
	        data: data
	    });
	});
	</script>
{% endblock %} 


{% block left_area %}
	{{ super() }}
	<div class="left-side-content">
	</div>

{% endblock %}

{% block content %}
<div id="project-panel" class="container">

	<div class="btn-toolbar col-xs-12 col-sm-9 z-btn-area">
		<button class="btn btn-primary col-md-2 z-btn-new" data-toggle="modal" data-target="#project_dialog">New</button>
		<button class="btn btn-primary col-md-2 z-btn-edit" data-toggle="modal" data-target="#project_dialog">Edit</button>
		<button class="btn btn-primary col-md-2 z-btn-del">Delete</button>
	</div>

	<div class="col-xs-12 col-sm-9">
		<table id="project-list"></table>
	</div>

	<!--/span-->
	
	<!-- Project Modal Dialog -->
	<div class="modal fade" id="project-dialog" tabindex="-1" role="dialog" aria-hidden="true">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	        <h4 class="modal-title">Project</h4>
	      </div>
	      
	      
	      <form id="project-form" action="/submit_project" method="post">
	      <div class="modal-body">
	      
				<div class="row form-group">
					<div class="z-label col-md-2">{{ 'Name' }}</div>
					<div class="col-md-7">
						<input class="form-control" name="name" type="text" placeholder="{{ 'Enter project name' }}" />
					</div>
					<div class="col-md-3 z-hint"></div>
				</div>
		
				<div class="row form-group">
					<div class="z-label col-md-2">{{ 'Description' }}</div>
					<div class="col-md-7">
						<textarea class="form-control" rows="5" name="description" placeholder="{{ 'Enter description' }}"></textarea>
					</div>
					<div class="col-md-3 z-hint"></div>
				</div>
		
				<div class="row form-group" >
					<div class="z-label col-md-2">{{ 'Plan' }}</div>
					<div class="col-md-3">
						<input class="form-control" name="start-date" data-date-format="mm/dd/yyyy" placeholder="{{ 'Start date' }}">
					</div>
					<div class="col-md-4 input-group">
						<span class="input-group-addon">to</span>
						<input class="form-control" name="end-date" data-date-format="mm/dd/yyyy" placeholder="{{ 'End date' }}">
					</div>
					<div class="col-md-3 z-hint"></div>
				</div>
				
				<input class="hide" type="text" name="mode" />
				<input class="hide" type="text" name="_id" />
				<input class="hide" type="text" name="created" />
	
	      </div>
	      
	      <div class="modal-footer">
	        <button class="btn btn-default canel" data-dismiss="modal">Close</button>
	        <button class="btn btn-primary submit">Save changes</button>
	      </div>
	      
	      </form>
	      
	    </div><!-- /.modal-content -->
	  </div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
	
</div>
{% endblock %}

{% block right_area %}
	<div class="right-side-area col-md-2">
		<div id="tree1"></div>
	</div>
{% endblock %}


